<template>
  <div class="aaa">
    <el-table
      :data="tableData"
      header-align="center"
      class="customer-table"
      height="table"
      empty-text="暂无数据"
    >
      <el-table-column align="center" prop="title" label="意见建议标题">
      </el-table-column>
      <el-table-column align="center" prop="namesJianYi" label="建议人">
      </el-table-column>
      <el-table-column align="center" label="提交时间">
        <template slot-scope="scope">
          <div>
            {{ timezhuanhuan1(scope.row.times) }}
          </div>
        </template>
      </el-table-column>
      <el-table-column align="center" prop="content" label="内容">
      </el-table-column>
      <el-table-column align="center" prop="namesChuLi" label="处理人">
      </el-table-column>
      <el-table-column align="center" prop="villagename" label="所属村">
      </el-table-column>
      <el-table-column align="center" prop="name" label="状态">
      </el-table-column>
      <el-table-column align="center" prop="address" label="操作">
        <template slot-scope="scope">
          <div @click="chakantanchucheng(scope.row)" class="caozuoshoubiao">
            详情
          </div>
        </template>
      </el-table-column>
    </el-table>

    <el-dialog title="提示" :visible.sync="chakanzhanshi" width="50%" center>
       <el-card class="box-card">
        <div slot="header" class="clearfix">{{tbdata.title}}</div>
        <div><span>意见建议人：{{tbdata.namesJianYi}}</span></div>
        <div><span>所属村：{{tbdata.villagename}}</span></div>
        <div><span>意见建议内容：{{tbdata.content}}</span></div>
        <div><span>活动图片：</span></div>
        <div><span>意见建议处理行政级别：{{tbdata.status}}</span></div>
        <div><span>意见建议处理人：{{tbdata.namesChuLi}}</span></div>
        <div><span>意见建议处理结果：</span></div>
      </el-card>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="chakanzhanshi = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>



<script>
var { timezhuanhuan1 } = require("../../js/global");
export default {
  props: ["biaogeqingqiucanshu", "fenyexinxi"],
  data() {
    return {
      tableData: [],
      // 点击查看应有的数据
      chakanzhanshi: false,
      tbdata: {},
    };
  },

  methods: {
    huoqushuju() {
      let params = new URLSearchParams();
      params.append("page", this.fenyexinxi.currentPage);
      params.append("processed", this.biaogeqingqiucanshu.zhuangtai);
      params.append("size", this.fenyexinxi.pagesize);
      params.append(
        "time",
        this.biaogeqingqiucanshu.selectshijian[0] +
          "~" +
          this.biaogeqingqiucanshu.selectshijian[1]
      );
      params.append("type", this.biaogeqingqiucanshu.leibie);
      params.append("villageId", this.biaogeqingqiucanshu.selectcun);
      params.append("zhenId", this.biaogeqingqiucanshu.selectzhen);
      this.$axios
        .post("/leader/feedbacktable", params)
        .then((response) => {
          console.log(response)
          response.data.data.data.records.forEach((item, index) => {
            item.namesJianYi = response.data.data.namesJianYi[index];
            item.namesChuLi = response.data.data.namesChuLi[index];
            item.times = response.data.data.times[index];
          });
          this.tableData = response.data.data.data.records;
          // 设置数据total
          this.$emit("setfenyetotal", response.data.data.data.total);
        })
        .catch((err) => {
          console.log(err);
        });
    },
    gengxin() {
      //更新表格
      this.huoqushuju();
    },
    chakantanchucheng(row) {
      this.tbdata = row;
      this.chakanzhanshi = true;
    },
    timezhuanhuan1: timezhuanhuan1,
  },
  created() {},
};
</script>

<style lang="less" scoped>
.aaa {
  height: 100%;
}
.el-table {
  height: 100%;
}
.box-card {
  background-color: #051655;
  color: #fff;
}
</style>